const commMiXin = {
	data() {
		return {

		}
	},
	methods: {
		/**
		 * 通用跳转
		 * @param {String|Number} path		路径或者返回页数
		 * @param {String} type		类型 navigate 默认 redirect reLaunch switchTab navigateBack
		 */
		gotoPage(path, type, options) {
			if (path) {
				let _options = {
					animationType: 'pop-in',
					animationDuration: 200
				}
				if (options) {
					_options = {
						...options
					}
				}
				if (type === 'navigate') {
					uni.navigateTo({
						url: path,
						..._options
					});
				} else if (type === 'redirect') {
					uni.redirectTo({
						url: path,
						..._options
					});
				} else if (type === 'reLaunch') {
					uni.reLaunch({
						url: path,
						..._options
					});
				} else if (type === 'switchTab') {
					uni.switchTab({
						url: path,
						..._options
					});
				} else if (type === 'navigateBack') {
					_options = {
						animationType: 'pop-out',
					}
					uni.navigateBack({
						delta: path,
						..._options
					});
				} else {
					uni.navigateTo({
						url: path,
						..._options
					});
				}
			}
		},
	}
}

export default commMiXin